package com.xinqi.common.core.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.xinqi.common.base.enums.BaseEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author：yyzhen
 * @Package：com.xinqi.common.core.enums
 * @Project：xingqiclass-cloud-plus
 * @name：ComplaintTypeEnum
 * @Date：2023/4/24 10:34
 * @Filename：ComplaintTypeEnum
 */
public enum ComplaintTypeEnum implements BaseEnum {

    /**
     * 欺诈
     */
    CHEAT("cheat", "欺诈"),

    /**
     * 仇恨言论
     */
    HATE_SPEECH("hate_speech", "仇恨言论"),

    /**
     * 垃圾广告
     */
    GARBAGE_ADVERTISING("garbage_advertising", "垃圾广告"),

    /**
     * 骚扰、分享不当内容
     */
    IMPROPER_CONTENT("improper_content", "骚扰、分享不当内容"),

    /**
     * 涉及未成年人不良信息
     */
    ADVERSE_INFORMATION("adverse_information", "涉及未成年人不良信息"),

    /**
     * 辱骂、脏话
     */
    ABUSE("abuse", "辱骂、脏话"),

    /**
     * 其他
     */
    OTHER("other", "其他");

    @Getter(onMethod_ = {@JsonValue})
    private final String code;

    @Getter
    private final String describe;

    ComplaintTypeEnum(String code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    @JsonCreator
    public static ComplaintTypeEnum of(String code) {
        return BaseEnum.of(ComplaintTypeEnum.class, code);
    }

    public static List<Map<String, String>> getSelectList() {
        List<Map<String, String>> list = new ArrayList<>();
        for (ComplaintTypeEnum typeEnum : ComplaintTypeEnum.values()) {
            Map<String, String> map = new HashMap<>();
            map.put("code", typeEnum.getCode());
            map.put("describe", typeEnum.getDescribe());
            list.add(map);
        }
        return list;
    }
}
